package ch.fusun.baron.basic.turntask;

import ch.fusun.baron.basic.messages.Messages;
import ch.fusun.baron.core.injection.Configure;
import ch.fusun.baron.core.injection.Inject;
import ch.fusun.baron.core.rmi.User;
import ch.fusun.baron.core.service.UserService;
import ch.fusun.baron.printing.MessagingService;
import ch.fusun.baron.turn.TurnTask;
import ch.fusun.baron.turn.UserTurnService;

/**
 * Increases the turn points after a turn
 */
public class IncreaseTurnPointsTask implements TurnTask {
	@Configure(value = "10")
	private final int POINTS = 50;
	@Inject
	private UserService userService;
	@Inject
	private UserTurnService userTurnService;
	@Inject
	private MessagingService messagingService;

	@Override
	public void execute() {
		for (User user : userService.getUsers()) {
			userTurnService.increaseTurnPoints(user, POINTS);
		}
		messagingService.addMessage(null,
				Messages.IncreaseTurnPointsTask_TurnPointsIncreased + POINTS);
	}

}
